<?php

/*
|--------------------------------------------------------------------------
| Routes File
|--------------------------------------------------------------------------
|
| Here is where you will register all of the routes in an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/



/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| This route group applies the "web" middleware group to every route
| it contains. The "web" middleware group is defined in your HTTP
| kernel and includes session state, CSRF protection, and more.
|
*/

Route::group(['middleware' => ['web']], function () {

    Route::get("/index","Index\IndexController@index");  //首页
    Route::get("/login","Index\IndexController@userLogin");//客户登录页面
    Route::post("/_login","Index\IndexController@_userLogin");  //执行客户登录
    Route::get("/logout","Index\IndexController@userLogout");  //客户退出登录
    Route::get("/register","Index\IndexController@userRegister");//客户注册
    Route::post("/_register","Index\IndexController@_userRegister");//执行客户注册

    Route::post("/searchDrug","Index\IndexController@searchDrug");

    Route::get('/goodsShop/{business_id}','Index\IndexController@goodsShop');//进入店铺

    Route::get("/adminLogin","Admin\AdminController@adminLogin");  //管理员登录
    Route::post("/adminLogins","Admin\AdminController@adminLogins");  //管理员登录
    Route::get("/adminLogout","Admin\AdminController@adminLogout");  //管理员退出登录

    Route::get('/businessLogin','Business\BusinessController@businessLogin'); //商家登录
    Route::post('/_businessLogin','Business\BusinessController@_businessLogin'); //商家登录
    Route::get('/businessRegister','Business\BusinessController@businessRegister'); //商家注册
    Route::post('/_businessRegister','Business\BusinessController@_businessRegister'); //商家注册
    Route::get('/businessLogout','Business\BusinessController@businessLogout');  //商家退出登录

    //管理员
    Route::group(['middleware' => ['LoginAdminCheck']], function () {
        Route::get("/searchBusiness","Admin\AdminController@searchBusiness");//查看商家
        Route::get("/checkBusiness","Admin\AdminController@checkBusiness");//审核商家
        Route::post("/changeBusiness","Admin\AdminController@changeBusiness");//商家审核通过
        Route::post("/delBusiness","Admin\AdminController@delBusiness");//商家审核未通过
        Route::get("/searchUser","Admin\AdminController@searchUser");
    });

    //商家
    Route::group(['middleware' => ['LoginBusinessCheck']], function () {
        Route::get('/myGoods','Business\ShopController@myGoods'); //查看自己的商品
        Route::post('/addGoods','Business\ShopController@addGoods'); //上架商品
        Route::post('/delGoods','Business\ShopController@delGoods'); //下架商品
        Route::get('/getOrder','Business\ShopController@getOrder');//收到的订单
        Route::get('/sendOrder/{drug_id}','Business\ShopController@sendOrder');//配货完成
        Route::get('/end/{drug_id}','Business\ShopController@end');//订单完成
        Route::get('/searchMyUser','Business\ShopController@searchMyUser');
    });



    //客户登录
    Route::group(['middleware' => ['LoginUserCheck']], function () {
        Route::get("/re_user_car/{business_id}","Index\OrderController@re_user_car"); //收藏店铺
        Route::get("/business_car","Index\OrderController@business_car");//收藏夹
        Route::post("/orderGoods","Index\OrderController@order_goods"); //预定药品
        Route::get("/goods_order","Index\OrderController@goods_order"); //我的预定
    });

    Route::group(['namespace' => 'Api'], function () {
        Route::get("/user/login","ApiController@login");// 登录
        Route::get("/user/register","ApiController@register");// 登录
        Route::get("/user/drugData","ApiController@drugData");//药品信息
        Route::get("/user/drugInfo","ApiController@drugInfo");
        Route::get("/user/businessData","ApiController@businessData");
        Route::get("/user/orderDrug","ApiController@orderDrug");
        Route::get("/user/myOrder","ApiController@myOrder");
        Route::get("/user/orderBusiness","ApiController@orderBusiness");
        Route::get("/user/myorderBusiness","ApiController@myorderBusiness");
        Route::get("/user/searchDrug","ApiController@searchDrug");
    });

});
